import axios from '../utils/request'
//登录接口
export function login(i) {
    return axios({
        url: 'login',
        method: "POST",
        data: {
            username: i.username,
            password: i.password
        }
    })
}
//左侧菜单栏
export function menus(){
    return axios({
        url:'menus',
        method:'get'
    })
}
//用户列表
export function users(data){
    return axios({
        url:'users',
        method:'get',
        params:data
    })
}
//设置用户状态
export function states(id,mg_state){
    return axios({
        url:`users/${id}/state/${mg_state}`,
        method:'put'
    })
}
//添加用户
export function add(data){
    return axios({
        url:'users',
        method:'post',
        data
    })
}
//删除用户
export function remove(id){
    return axios({
        url:`users/${id}`,
        method:'delete'
    })
}
//编辑前获取
export function beforeEdit(id){
    return axios({
        url:`users/${id}`,
        method:'get'
    })
}
//编辑用户
export function editAdd(id,data){
    return axios({
        url:`users/${id}`,
        method:'put',
        data
    })
}
//权限列表
export function rights(){
    return axios({
        url:'rights/list',
        method:'get'
    })
}
//角色列表
export function roles(){
    return axios({
        url:'roles',
        method:'get'
    })
}
//角色列表添加
export function addles(data){
    return axios({
        url:'roles',
        method:'post',
        data
    })
}
//角色列表编辑查询id
export function fine(id){
    return axios({
        url:`roles/${id}`,
        method:'get',
    })
}
//角色列表编辑
export function editRoles(id,data){
    return axios({
        url:`roles/${id}`,
        method:'put',
        data
    })
}
//角色列表删除
export function del(id){
    return axios({
        url:`roles/${id}`,
        method:'delete'
    })
}
//获取商品列表数据
export function goods(data){
    return axios({
        url:'goods',
        method:'get',
        params: data
    })
}
//商品列表删除
export function delGoods(id){
    return axios({
        url:`goods/${id}`,
        method:'delete'
    })
}
//商品分类参数
export function categories(){
    return axios({
        url:'categories',
        method:'get'
    })
}
//商品分类列表
export function getList(data){
    return axios({
        url:'categories',
        method:'get',
        params: data
    })
}
//商品分类添加
export function addCate(data){
    return axios({
        url:'categories',
        method:'post',
        data
    })
}
// 商品分类编辑
export function editCate(id){
    return axios({
        url:`categories/${id}`,
        method:'get'
    })
}
// 编辑商品分类提交
export function editCater(id,data){
    return axios({
        url:`categories/${id}`,
        method:'put',
        data
    })
}
// 删除
export function delCater(id){
    return axios({
        url:`categories/${id}`,
        method:'delete',
    })
}
// 订单列表
export function orderList(data){
    return axios({
        url:'orders',
        method:'get',
        params: data
    })
}